package cn.kgc.javaweb.util;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: mosin
 * @version: v1.0  2022/11/2
 * 分页数据的封装
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class PageDate {

    //当前页
    private  Integer currentPage;
    // 每页显示的条数
    private  Integer limit;
    // 总条数
    private  Long total;
    // 总页数
    private  Long totalPage;
    // 当前页显示的数据
    private  Object data;

    public  Long  getTotalPage(){

        // 15  5  3
        totalPage = total%limit==0 ? total/limit:(total/limit)+1;

        return  totalPage;
    }

}
